package com.bgIntlgn.client.entity.manufacture;

import java.util.Date;

import yuhuibear.poat.annotations.action.AutoGenerateValue;
import yuhuibear.poat.annotations.relation.Field;
import yuhuibear.poat.annotations.relation.Table;
import yuhuibear.poat.object.bean.Bean;

/**
 * 生产计划
 * 
 * @author yuhui
 * 
 */
@Table(name = "production_plans", constrain = "")
public class ProductionPlan implements Bean {

	@AutoGenerateValue(skipOnNull = true, sqlToGet = "select currval('production_plans_id_seq')")
	@Field(name = "id", type = "bigserial", constrain = "primary key ")
	private Long id;

	/**
	 * 流水号
	 */
	@Field(name = "serial_nu", type = "varchar(80)", constrain = "unique")
	private String serialNu;

	/**
	 * 生产计划的优先级， 这个优先级会向生产和采购传播
	 */
	@Field(name = "priority", type = "int ", constrain = "not null default 0")
	private Integer priority;

	/**
	 * 状态。
	 */
	public enum State {
		draft(0), preparing(1), producing(2), done(3);

		private State(int i) {
			;
		};
	}

	/**
	 * 状态取上面的枚举值的值
	 */
	@Field(name = "state", type = "int", constrain = "default 0")
	private Integer state;

	/**
	 * 计划类型
	 */
	public enum Type {
		plan, order, oem;
	}

	/**
	 * 状态取上面的枚举值的值 计划类型
	 */
	@Field(name = "type", type = "int", constrain = "default 0")
	private Integer type;

	@Field(name = "create_date", type = "date", constrain = "")
	private Date createDate;

	@Field(name = "start_date", type = "date", constrain = "")
	private Date startDate;

	/**
	 * 生产结束日期, 全计划的结束日期
	 */
	@Field(name = "end_date", type = "date", constrain = "")
	private Date endDate;

	@Field(name = "creater", type = "int8", constrain = "not null references employees(id)  on update cascade ")
	private Long creater;

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getStartDate() {
		return this.startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return this.endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public Long getCreater() {
		return this.creater;
	}

	public void setCreater(Long creater) {
		this.creater = creater;
	}

	public Integer getPriority() {
		return this.priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public String getSerialNu() {
		return this.serialNu;
	}

	public void setSerialNu(String serialNu) {
		this.serialNu = serialNu;
	}

	public Integer getState() {
		return this.state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

}
